package cn.com.greatwall.common.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import cn.com.greatwall.common.utils.SystemAdminConstant;
import lombok.Data;

/** 
* @Author herw
* @Time 2020-06-20 9:19:26 PM 
* @Version 1.0
* @Description:
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "file")
public class FileProperties {
    /** 文件大小限制 */
    private Long maxSize;

    /** 头像大小限制 */
    private Long avatarMaxSize;

    private SystemPath mac;

    private SystemPath linux;

    private SystemPath windows;

    public SystemPath getPath(){
        String os = System.getProperty("os.name");
        if(os.toLowerCase().startsWith(SystemAdminConstant.WIN)) {
            return windows;
        } else if(os.toLowerCase().startsWith(SystemAdminConstant.MAC)){
            return mac;
        }
        return linux;
    }

    @Data
    public static class SystemPath{

        private String path;

        private String avatar;
    }
}
